/****************************************************************************************
This file is part of Proactive Investigator Analytics.

Proactive Investigator Analytics is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Proactive Investigator Analytics is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Proactive Investigator Analytics.  If not, see <http://www.gnu.org/licenses/>.

This script creates SMTP staging tables and indexes for partition switch purpose.

****************************************************************************************/
USE RiskSecurityDW
GO

-- Create tables
CREATE TABLE [dbo].[stg_fact_smtp_outer_relay_11](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE CLUSTERED INDEX [IX_stg_fact_smtp_outer_relay_11] ON [dbo].[stg_fact_smtp_outer_relay_11] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_outer_relay_10](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE CLUSTERED INDEX [IX_stg_fact_smtp_outer_relay_10] ON [dbo].[stg_fact_smtp_outer_relay_10] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_outer_relay_9](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO
 
CREATE CLUSTERED INDEX [IX_stg_fact_smtp_outer_relay_9] ON [dbo].[stg_fact_smtp_outer_relay_9] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_outer_relay_8](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE CLUSTERED INDEX [IX_stg_fact_smtp_outer_relay_8] ON [dbo].[stg_fact_smtp_outer_relay_8] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_outer_relay_7](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE CLUSTERED INDEX [IX_stg_fact_smtp_outer_relay_7] ON [dbo].[stg_fact_smtp_outer_relay_7] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_outer_relay_6](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE CLUSTERED INDEX [IX_stg_fact_smtp_outer_relay_6] ON [dbo].[stg_fact_smtp_outer_relay_6] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_outer_relay_5](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE CLUSTERED INDEX [IX_stg_fact_smtp_outer_relay_5] ON [dbo].[stg_fact_smtp_outer_relay_5] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_outer_relay_4](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE CLUSTERED INDEX [IX_stg_fact_smtp_outer_relay_4] ON [dbo].[stg_fact_smtp_outer_relay_4] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_outer_relay_3](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE CLUSTERED INDEX [IX_stg_fact_smtp_outer_relay_3] ON [dbo].[stg_fact_smtp_outer_relay_3] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_outer_relay_2](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE CLUSTERED INDEX [IX_stg_fact_smtp_outer_relay_2] ON [dbo].[stg_fact_smtp_outer_relay_2] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_outer_relay_1](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE CLUSTERED INDEX [IX_stg_fact_smtp_outer_relay_1] ON [dbo].[stg_fact_smtp_outer_relay_1] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_outer_relay_0](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE CLUSTERED INDEX [IX_stg_fact_smtp_outer_relay_0] ON [dbo].[stg_fact_smtp_outer_relay_0] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_inner_relay_11](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE CLUSTERED INDEX [IX_stg_fact_smtp_inner_relay_11] ON [dbo].[stg_fact_smtp_inner_relay_11] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_inner_relay_10](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE CLUSTERED INDEX [IX_stg_fact_smtp_inner_relay_10] ON [dbo].[stg_fact_smtp_inner_relay_10] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_inner_relay_9](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE CLUSTERED INDEX [IX_stg_fact_smtp_inner_relay_9] ON [dbo].[stg_fact_smtp_inner_relay_9] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_inner_relay_8](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE CLUSTERED INDEX [IX_stg_fact_smtp_inner_relay_8] ON [dbo].[stg_fact_smtp_inner_relay_8] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_inner_relay_7](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO
CREATE CLUSTERED INDEX [IX_stg_fact_smtp_inner_relay_7] ON [dbo].[stg_fact_smtp_inner_relay_7] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_inner_relay_6](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO
CREATE CLUSTERED INDEX [IX_stg_fact_smtp_inner_relay_6] ON [dbo].[stg_fact_smtp_inner_relay_6] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_inner_relay_5](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO
CREATE CLUSTERED INDEX [IX_stg_fact_smtp_inner_relay_5] ON [dbo].[stg_fact_smtp_inner_relay_5] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_inner_relay_4](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO
CREATE CLUSTERED INDEX [IX_stg_fact_smtp_inner_relay_4] ON [dbo].[stg_fact_smtp_inner_relay_4] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_inner_relay_3](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO
CREATE CLUSTERED INDEX [IX_stg_fact_smtp_inner_relay_3] ON [dbo].[stg_fact_smtp_inner_relay_3] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_inner_relay_2](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO
CREATE CLUSTERED INDEX [IX_stg_fact_smtp_inner_relay_2] ON [dbo].[stg_fact_smtp_inner_relay_2] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_inner_relay_1](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO
CREATE CLUSTERED INDEX [IX_stg_fact_smtp_inner_relay_1] ON [dbo].[stg_fact_smtp_inner_relay_1] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

CREATE TABLE [dbo].[stg_fact_smtp_inner_relay_0](
	[log_date_time] [datetime] NULL,
	[msg_type] [varchar](15) NULL,
	[m_id] [bigint] NULL,
	[ic_id] [bigint] NULL,
	[message] [varchar](2048) NULL,
	[src_file] [varchar](255) NULL,
	[server_name] [varchar](100) NULL
) ON [SMTP_DayDateRange2PS]([log_date_time])
GO
CREATE CLUSTERED INDEX [IX_stg_fact_smtp_inner_relay_0] ON [dbo].[stg_fact_smtp_inner_relay_0] 
(
	[log_date_time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 85) ON [SMTP_DayDateRange2PS]([log_date_time])
GO

